//-----------------------------------------------------------------------
// <copyright file="RegistrationMemberElement.cs" company="iron9light">
//      Copyright (c) iron9light. All rights reserved.
// </copyright>
// <author>iron9light</author>
//-----------------------------------------------------------------------

namespace EventBrokerExtension.Configuration
{
    using System;
    using System.Configuration;

    using Microsoft.Practices.Unity.Configuration;

    /// <summary>
    /// Base class for custom injection member elements.
    /// </summary>
    public abstract class RegistrationMemberElement : InjectionMemberElement
    {
        /// <summary>
        /// Gets the type of the element.
        /// </summary>
        /// <value>The type of the element.</value>
        [ConfigurationProperty("elementType")]
        public Type ElementType
        {
            get { return this.GetType(); }
        }

        /// <summary>
        /// Gets or sets the event topic.
        /// </summary>
        /// <value>The event topic.</value>
        [ConfigurationProperty("topic", IsRequired = true)]
        public string EventTopic
        {
            get { return (string)this["topic"]; }
            set { this["topic"] = value; }
        }

        protected override object GetElementKey()
        {
            return base.GetElementKey() + ":" + this.EventTopic;
        }
    }
}